package com.showgood.core {
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	/**
	 * ...
	 * @author bianpeng
	 */
	public class DisplayElement {
		public var _x:int;
		public var _y:int;
		
		private var _sprite:DisplayObject;
		
		public function DisplayElement() {
			
		}
		
		/**
		 * override in child class
		 * @return
		 */
		protected function createDisplayObject(): DisplayObject {
			var sprite:Sprite = new Sprite();
			sprite.graphics.lineStyle(1);
			sprite.graphics.drawRect( -10, -5, 20, 10);
			return sprite;
		}
		
		public function render():void {
			if (!_sprite) {
				_sprite = createDisplayObject();
			}
			_sprite.x = _x;
			_sprite.y = _y;
		}
		
		public function get displayObject():DisplayObject {
			return _sprite;
		}
	}

}


